/**
 * Feb 24, 2022
 */
package com.citahub.util;

import java.io.IOException;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import com.moandjiezana.toml.Toml;

public class TomlUtils {

  private final String path;

  public TomlUtils(String path) {
    this.path = path;
  }

  public String getPath() {
    return path;
  }

  public Toml getToml() throws IOException {
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    Resource resource = resolver.getResource(getPath());
    return new Toml().read(resource.getInputStream());
  }
}
